package cn.tpshion.vm.controller;

import cn.tpshion.vm.common.model.Result;
import cn.tpshion.vm.domain.dto.node.NodeImageDTO;
import cn.tpshion.vm.domain.entity.NodeImage;
import cn.tpshion.vm.service.NodeService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/node")
public class NodeController {

    @Resource
    private NodeService nodeService;

    @GetMapping("/imageList")
    public Result<List<NodeImage>> imageList(@RequestParam(required = false) String type){
        return Result.ok(nodeService.imageList(type));
    }

    @PostMapping("/addImage")
    public Result addImage(@Valid @RequestBody NodeImageDTO dto){
        nodeService.addImage(dto);
        return Result.ok();
    }
}
